// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "InputActionValue.h"
#include "PaperZDCharacter.h"

#include "ActionCharacterBase.generated.h"

class UInputMappingContext;
class UInputAction;


/**
 *	动作角色基类
 */
UCLASS()
class ACTIONPLATFORMER_API AActionCharacterBase : public APaperZDCharacter
{
	GENERATED_BODY()

public:
	virtual  void SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) override;

	// 解除绑定输入
	UFUNCTION(BlueprintCallable, Category="输入")
	void UnBindingInput();

	virtual void PossessedBy(AController* NewController) override;

	// 默认的映射
	UPROPERTY(EditDefaultsOnly, Category="默认")
	UInputMappingContext* MappingContext = nullptr;

	// 跳跃动作
	UPROPERTY(EditDefaultsOnly, Category="默认")
	UInputAction* JumpAction = nullptr;

	// 跳跃按下
	UFUNCTION(BlueprintImplementableEvent)
	void JumpPressed();

	// 跳跃松开
	UFUNCTION(BlueprintImplementableEvent)
	void JumpReleased();

	// 攻击动作
	UPROPERTY(EditDefaultsOnly, Category="默认")
	UInputAction* AttackAction = nullptr;

	// 攻击按下
	UFUNCTION(BlueprintImplementableEvent)
	void AttackPressed();
	// 攻击松开
	UFUNCTION(BlueprintImplementableEvent)
	void AttackReleased();
	
	// 扔出动作
	UPROPERTY(EditDefaultsOnly, Category="默认")
	UInputAction* ThrowAction = nullptr;
	
	// 扔出按下
	UFUNCTION(BlueprintImplementableEvent)
	void ThrowPressed();
	// 扔出松开
	UFUNCTION(BlueprintImplementableEvent)
	void ThrowReleased();

	// 移动动作
	UPROPERTY(EditDefaultsOnly, Category="默认")
	UInputAction* MoveAction = nullptr;

	/** 运动输入
	 * @brief		运动输入
	 * @param Value	绑定的动作
	 */
	UFUNCTION(BlueprintImplementableEvent)
	void Move(const FInputActionValue& Value);

	/** 运动输入结束
	 * @brief		运动输入结束
	 * @param Value 绑定的动作
	 */
	UFUNCTION(BlueprintImplementableEvent)
	void MoveCompleted(const FInputActionValue& Value);
	
};
